package com.hzlj.position.job.job;

import com.fz.common.redis.annotation.SyncLock;
import com.hzlj.position.locate.service.DifferentiationDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class DifferentiationDataJob {
    @Resource
    private DifferentiationDataService differentiationDataService;

    /**
     * 删除定位缓存
     */
    @SyncLock(lockMs = 60000)
    @Scheduled(cron = "${differentiation.data:0 0/1 * * * ?}")
    public void sync() {
        long start = System.currentTimeMillis();
        log.info("任务开始执行[独立业务数据]");
        int size = differentiationDataService.handle();
        log.info("任务结束执行[独立业务数据],cost={},size={}", System.currentTimeMillis() - start, size);
    }
}
